<?php
include "../includes/config.php"; // memanggil  file koneksi.php
$file_name=$_FILES['logo']['name']; //nama file (tanpa path)
$tmp_name=$_FILES['logo']['tmp_name']; //nama local temp file di server
$file_size=$_FILES['logo']['size']; //ukuran file (dalam bytes)
$file_type=$_FILES['logo']['type']; //tipe filenya (langsung detect MIMEnya)
$fp=fopen($tmp_name,'r'); // open file (read-only, binary)
$file_content=fread($fp, $file_size) or die("Tidak dapat membaca source file"); // read file
$file_content=mysql_real_escape_string($file_content) or die("Tidak dapat membaca source file"); // parse image ke string
fclose($fp); // tuptup file

    /* query dan proses handling untuk melakukan insert ke database*/

$qu="UPDATE gambar SET file_content='$file_content',file_name='$file_name',file_type='$file_type',file_size='$file_size' WHERE id='9'";
$re=mysql_query($qu) or die ("Gagal UPDATE ke database");
echo $file_name." berhasil di-insertkan ke database";
?>
<meta http-equiv="refresh" content="5;url=../spm-itats/cpanel?setting=logo" />